package com.leeon.container.exercise;

import java.util.*;

public class MoviesGenerator {

   private String[] movies = {"Snow White","Bashful","Doc","Dopey","Grumpy","Happy","Sleepy","Sneezy"};
   private int index = 0;

    public String next(){
        if(index >= movies.length){
            index = 0;
        }
        return movies[index++];
    }

    public static void main(String[] args){
        MoviesGenerator generator = new MoviesGenerator();

        String[] arr = new String[20];
        ArrayList<String> arrayList = new ArrayList<String>();
        LinkedList<String> linkedList = new LinkedList<String>();
        HashSet<String> hashSet = new HashSet<String>();
        TreeSet<String> treeSet = new TreeSet<String>();
        LinkedHashSet<String> linkedHashSet = new LinkedHashSet<String>();

        for (int i = 0; i < 20; i++) {
            String movie = generator.next();
            arr[i] = movie;
            arrayList.add(movie);
            linkedList.add(movie);
            hashSet.add(movie);
            treeSet.add(movie);
            linkedHashSet.add(movie);
        }

        System.out.println(arr);
        System.out.println(arrayList);
        System.out.println(linkedList);
        System.out.println(hashSet);
        System.out.println(treeSet);
        System.out.println(linkedHashSet);

    }
}
